package com.huiyujinrong.qiangdanbao.activity.my;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.huiyujinrong.qiangdanbao.R;
import com.huiyujinrong.qiangdanbao.utils.JuCircle;
import com.squareup.picasso.Picasso;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 身份证明
 * 2017/4/12
 * yd
 */
public class SelectID extends AppCompatActivity {

    @BindView(R.id.toolbar_Title)
    TextView title;
    @BindView(R.id.toolbar_Back)
    RelativeLayout back;

    @BindView(R.id.id_just)
    ImageView id_just;
    @BindView(R.id.id_back)
    ImageView id_back;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.select_id);
        ButterKnife.bind(this);
        setToolbar();

        Intent intent = getIntent();
        String just = intent.getStringExtra("id_just");
        String back = intent.getStringExtra("id_back");

        if (TextUtils.isEmpty(just)) {
            id_just.setBackgroundResource(R.drawable.img_idpositive);
        } else {
            Picasso.with(this)
                    .load(just)
                    .fit()
                    .transform(new JuCircle())
                    .into(id_just);
        }
        if (TextUtils.isEmpty(back)) {
            id_back.setBackgroundResource(R.drawable.img_idnegative);
        } else {
            Picasso.with(this)
                    .load(back)
                    .fit()
                    .transform(new JuCircle())
                    .into(id_back);
        }
    }

    //设置 toolbar
    private void setToolbar() {
        back.setVisibility(View.VISIBLE);
        title.setText(R.string.upload_ID);
    }


    @OnClick(R.id.toolbar_Back)
    void back() {
        finish();
    }

}
